<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="../style/main.css" type="text/css" rel="stylesheet">
        <link href="../style/update_info.css" type="text/css" rel="stylesheet">
        <script type="text/javascript" src="../script/jquery-1.8.2.js"></script>
        <script type="text/javascript" src="../script/update_info.js"></script>
</head>
        <?php 
            session_start();
            mysql_connect("localhost:3306", "root", "16886611");
            mysql_select_db("digitalsales");
            $result=mysql_query("SELECT TYPE FROM customers WHERE ACCOUNT = '".$_SESSION['username']."'");
            $res = mysql_fetch_array($result);
            echo '<body onload="load(\''.$res[0].'\')">';
            
        ?>


 <header>
        <?php
        
        if(isset($_GET["action"])){
            if($_GET["action"]=="logout"){
               $_SESSION["username"]=NULL;
            }
        }
        if(!isset($_SESSION["username"])||$_SESSION["username"]==NULL){
        echo '<ul>
                 <li>
                    <p><a href="../index.php">Homepage</a></p>
                  </li>
                </ul>';
        }else{
            echo '<ul>
                <li id="logout">
                  <p><a href="../index.php?action=logout">Log out</a></p>
                </li>
                 <li>
                    <p><a href="../myAccount/myAccount.php">My Account</a></p>
                  </li>
                  <li>
                    <p><a href="../myAccount/order.php">My Orders</a></p>
                  </li>
                  <li>
                    <p>Welcome back,'.$_SESSION["username"].'!</p>
                  </li>
                </ul>';
        }
        
        ?>
        </header>

    <?php
    
    $resSet1 = mysql_query("SELECT * FROM customers WHERE ACCOUNT = '".$_SESSION['username']."'");
    $eachRow1 = mysql_fetch_array($resSet1);
    $name=$eachRow1[2];
    $street=$eachRow1[3];
    $city=$eachRow1[4];
    $state=$eachRow1[5];
    $zip=$eachRow1[6];
    
    $resSet2 = mysql_query("SELECT * FROM business_info WHERE CUSTOMER = '".$_SESSION['username']."'");
    $eachRow2 = mysql_fetch_array($resSet2);
    $income1=$eachRow2[2];
  
    $resSet3 = mysql_query("SELECT * FROM home_info WHERE CUSTOMER = '".$_SESSION['username']."'");
    $eachRow3 = mysql_fetch_array($resSet3);
    $age=$eachRow3[3];
    $income2=$eachRow3[4];
    
    ?>
    
<div id="update" class="MainPanel">

Update Information<br />

</div>

    <div id="business_update" class="MainPanel">  
            
    <form action="business_update.php" method="post">

  <table>

<tr>
<th>Company Name</th>
<td>
    <?php
    echo'<input type="text" style="height: 26px;" name="companyname" size="30" value = '.$name.'>';
?>
</td>
</tr>

<tr>
<th>Street</th>
<td>
    <?php
    echo'<input type="text" style="height: 26px;" name="street" size="30" value = '.$street.'>';
?>
</td>
</tr>

<tr>
<th>City</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="city" size="30" value = '.$city.'>';
?></td>
</tr>

<tr>
<th>State</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="state" size="30" value = '.$state.'>';
?></td>
</tr>

<tr>
<th>Zip</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="zip" size="30" value = '.$zip.'>';
?></td>
</tr>

<tr>
<th>Business Category</th>    
<td>
<select style="width: 168pt;" name="BusinessCategory">
<option value="">Select your category</option>
<option value="Arts">Arts</option>
<option value="Books">Books</option>
<option value="Clothing">Clothing</option>
<option value="Electronics">Electronics</option>
<option value="Food">Food</option>
<option value="Health">Health</option>
<option value="Pets">Pets</option>
<option value="Sports">Sports</option>
<option value="Travel">Travel</option>
<option value="Vehicles">Vehicles</option>
</select>
</td>
</tr>

<tr>
<th>Annual Income</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="income" size="30" value = '.$income1.'>';
?></td>
<tr>

<tr>
<th></th>
<td><input type="submit" id="submit_button" value="Submit"><td>
</tr>

  </table>

</form>

    

</div>

<div id="home_update" class="MainPanel">

<form action="home_update.php" method="post">

<table>

<tr>
<th>Name</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="name" size="30" value = '.$name.'>';
?></td>
</tr>

<tr>
<th>Street</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="street" size="30" value = '.$street.'>';
?></td>
</tr>

<tr>
<th>City</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="city" size="30" value = '.$city.'>';
?></td>
</tr>

<tr>
<th>State</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="state" size="30" value = '.$state.'>';
?></td>
</tr>

<tr>
<th>Zip</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="zip" size="30" value = '.$zip.'>';
?></td>
</tr>

<tr>
<th>Gender</th>
<td>
<select style="width: 168pt;" name="Gender">
<option value="">Select your gender</option>
<option value="M">Male</option>
<option value="F">Female</option>
</select>
</td>
</tr>

<tr>
<th>Marriage Status</th>
<td>
<select style="width: 168pt;" name="MarriageStatus">
<option value="">Select your status</option>
<option value="Y">Married</option>
<option value="N">Unmarried</option>
</select>
</td>
</tr>

<tr>
<th>Age</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="age" size="30" value = '.$age.'>';
?></td>
</tr>

<tr>
<th>Annual Income</th>
<td><?php
    echo'<input type="text" style="height: 26px;" name="income" size="30" value = '.$income2.'>';
?></td>
</tr>

<tr>
<th></th>
<td><input type="submit" id="submit_button" value="Submit"></td>
</tr>

</table>

</form>

</div>
        </div>
</body>

</html>